package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpITADEnterItemPageUtil extends SeleniumPageUtil {
	public final static By IIMEI_SPAN_TITLE = By.id("ctl44_lblModelBoxTitle");
	public final static By IIMEI_TD_WAREHOUSE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[1]/td[1]");
	public final static By IIMEI_INPUT_WAREHOUSE = By.id("ctl44_txtWarehouse");
	public final static By IIMEI_SPAN_BIN_NO = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[1]/td[3]");
	public final static By IIMEI_INPUT_BIN_NO = By.id("ctl44_txtNewBin");
	public final static By IIMEI_TD_LOT = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[2]/td[1]");
	public final static By IIMEI_INPUT_LOT = By.id("ctl44_txtLot");
	public final static By IIMEI_TD_MODEL = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[2]/td[3]");
	public final static By IIMEI_INPUT_MODEL = By.id("ctl44_txtModel");
	public final static By IIMEI_TD_QUANTITY = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[3]/td[1]");
	public final static By IIMEI_INPUT_QUANTITY = By.id("ctl44_txtQuantity");
	public final static By IIMEI_TD_CPU_SPEED_GHZ = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[3]/td[3]");
	public final static By IIMEI_INPUT_CPU_SPEED_GHZ = By.id("ctl44_txtSizeSpeed");
	public final static By IIMEI_TD_STATUS = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[4]/td[1]");
	public final static By IIMEI_SELECT_STATUS = By.id("ctl44_ddlScanItemStatus");
	public final static By IIMEI_TD_SMS_NO = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[4]/td[3]");
	public final static By IIMEI_INPUT_SMS_NO = By.id("ctl44_txtSMS");
	public final static By IIMEI_TD_CATEGORY = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[5]/td[1]");
	public final static By IIMEI_SELECT_CATEGORY = By.id("ctl44_ddlCategories");
	public final static By IIMEI_TD_MANUFACTURER = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[5]/td[3]");
	public final static By IIMEI_INPUT_MANUFACTURER = By.id("ctl44_txtManufacturer");
	public final static By IIMEI_TD_CONDITION = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[6]/td[1]");
	public final static By IIMEI_INPUT_CONDITION = By.id("ctl44_txtCondition");
	public final static By IIMEI_TD_ASSET_TAG = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[6]/td[3]");
	public final static By IIMEI_INPUT_ASSET_TAG = By.id("ctl44_txtAssetTag");
	public final static By IIMEI_TD_SIZE_GB = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[7]/td[1]");
	public final static By IIMEI_INPUT_SIZE_GB = By.id("ctl44_txtGb");
	public final static By IIMEI_TD_CPUS_NUMBER = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[7]/td[3]");
	public final static By IIMEI_INPUT_CPU_NUMBER = By.id("ctl44_txtCpuNumber");
	public final static By IIMEI_TD_CPU_SPEED = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[8]/td[1]");
	public final static By IIMEI_INPUT_CPU_SPEED = By.id("ctl44_txtCpuSpeed");
	public final static By IIMEI_TD_RAM_MG = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[8]/td[3]");
	public final static By IIMEI_INPUT_RAN_MG = By.id("ctl44_txtRam");
	public final static By IIMEI_TD_COMMENT = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[9]/td[1]");
	public final static By IIMEI_INPUT_COMMENT = By.id("ctl44_txtComment");
	public final static By IIMEI_TD_SERIAL_NUMBER = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[9]/td[3]");
	public final static By IIMEI_TEXTAREA_SERIAL_NUMBER = By.id("ctl44_txtSerialNumber");
	
	public final static By IIMEI_LINK_SAVE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[11]/td[1]/a");
	public final static By IIMEI_LINK_CLOSE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/div/table/tbody/tr[11]/td[2]/a");
	
	// when input something the div should be displayed
	public final static By ITMET_DIV_WAREHOUSE_LIST = By.id("aceWarehouse_completionListElem");
	// an element of warehouse list div
	public final static By ITMET_TD_ELEMENT_WAREHOUSE_LIST = By.xpath("//*[@id='aceWarehouse_completionListElem']/table/tbody/tr[1]/td[1]");
	
	public final static By ITMET_DIV_BIN_LIST = By.id("aceBin_completionListElem");
	
	public static void enterITADEnterItemPage(){
		SpITADDefaultPageUtil.enterITADInventoryManagementDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpITADDefaultPageUtil.IIM_LINK_ENTER_ITEM));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				IIMEI_TEXTAREA_SERIAL_NUMBER, IIMEI_SELECT_STATUS, IIMEI_SELECT_CATEGORY, IIMEI_LINK_SAVE, IIMEI_LINK_CLOSE
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IIMEI_TEXTAREA_SERIAL_NUMBER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IIMEI_SELECT_STATUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IIMEI_SELECT_CATEGORY));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IIMEI_LINK_SAVE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IIMEI_LINK_CLOSE));
	}
}
